<template>
    <div>
        <div><input v-model="name"></div>
        <div><input v-model="password"></div>
        <p>{{ tip }}</p>
    </div>
</template>


<script>
import { computed,ref, watch } from 'vue'
export default {
    setup() {
        const name = ref("");
        const password = ref("");
        const tip = ref("");
        //侦听器
        watch(password, (newValue, oldValue) => {
            //新值小于六位,做提示
            if (newValue.length<6) {
                tip.value = "密码过短"
            }
            else {
                tip.value = ""
            }
        })
        return {
            name,
            password,
            tip
        }
    }
}
</script>
    

<style></style>